import React from 'react';
import ReactECharts from 'echarts-for-react';

export default function CompanyTypePie({ data, style }) {
  const option = {
    title: { text: '企业种类占比', left: 'center', top: 10, textStyle: { color: '#00eaff', fontSize: 18, fontWeight: 700 } },
    tooltip: { trigger: 'item' },
    legend: { 
      orient: 'vertical', 
      left: 'left', 
      top: 50,
      textStyle: { color: '#fff' }
    },
    series: [
      {
        label: {
          show: false,
          position: 'outside',
          formatter: '{b}: {c} ({d}%)',
          textStyle: { color: '#fff' }
        },
        type: 'pie',
        radius: '50%',
        data: data,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  };

  return (
    <div style={{ width: '100%', height: 180, ...style }}>
      <ReactECharts option={option} style={{ width: '100%', height: 180 }} />
    </div>
  );
} 